<include file='Public/_header'/>
<link href="__CSS__/plugins/datapicker/datepicker3.css" rel="stylesheet">
<link href="__CSS__/plugins/select2/select2.css" rel="stylesheet"/>
<link href="__CSS__/plugins/waitMe/waitMe.min.css" rel="stylesheet">
<link href="__CSS__/plugins/toastr/toastr.min.css" rel="stylesheet"/>
<style>
    .select2-container .select2-choice {  
        height: 34px;  
        line-height: 34px;  
    }  
    .select-form-control{
        background-image: none;
        transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
        width: 100%;
        font-size: 14px;
    }
    table thead .sorting_asc:after {
        float: right;
        content: "\f0de";
        font-family: fontawesome;
    }
    table thead .sorting_desc:after {
        content: "\f0dd";
        float: right;
        font-family: fontawesome;
    }
    table thead .sorting:after {
        content: "\f0dc";
        float: right;
        font-family: fontawesome;
        color: rgba(50, 50, 50, 0.5);
    }
    table thead .sorting, table thead .sorting_asc, table thead .sorting_desc, table thead .sorting_asc_disabled, table thead .sorting_desc_disabled {
        cursor: pointer;
    }
</style>
<include file='Public/_headerEnd'/>
<include file='Public/_menu'/>
<div id="page-wrapper" class="gray-bg dashbard-1">
    <include file='Public/_nav'/>
    <include file='Public/_breadcrumb'/>
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <h3>阅读/页面配置</h3>
                        <form method="post" class=" p-sm"  action="{:U('Options/add')}" id="form">
                            <div class="form-group div-container">
                                <label class="control-label ">博客页面显示文章的数量</label>
                                <div><input type="text" class="form-control col-lg-6" name="posts_per_page" id="posts_per_page"/></div>
                            </div>
                            <div class="form-group div-container">
                                <label class="control-label ">翻页条显示翻页的数量</label>
                                <div><input type="text" class="form-control" name="page_num" id="page_num"/></div>
                            </div>
                            <div class="form-group">
                                <input type="hidden" value="read" name="module"/>
                                <div class="col-sm-2"><button class="btn btn-primary m-b"  type="submit">保存</button></div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <include file='Public/_footer'/>
</div>
<include file='Public/_loadJs'/>
<script src="__JS__/plugins/datapicker/bootstrap-datepicker.js"></script>
<script src="__JS__/plugins/waitMe/waitMe.min.js"></script>
<script src='__JS__/plugins/select2/select2.js'></script>
<script src="__JS__/plugins/validForm/Validform_v5.3.2_min.js"></script>
<script src="__JS__/plugins/toastr/toastr.min.js"></script>
<script type='text/javascript'>
    var waitMeConfig = {
        effect: 'facebook',
        text: '',
        bg: 'rgba(255, 255, 255, 0.7)',
        color: '#000',
        sizeW: '',
        sizeH: ''
    };
    var search_url = "{:U('Tag/search')}"
    $("#search").click(function () {
        var params = $("#form").serialize();
        $("#refresh_box").waitMe(waitMeConfig);
        loadList(params);
    });

    function loadList(params) {
        $.post(search_url, params, function (data) {
            if (data.status == 1) {
                $("#refresh_box").html(data.content);
            } else {
                toastr.error(data.info);
            }
        })
    }
    $("#refresh_box").on('click', '.page a', function () {
        var params = $("#form").serialize();
        var page = $(this).attr('data-num');
        params = params + "&page=" + page;
        loadList(params);
    });
    $(".select-no-search").select2({
        theme: "classic",
        minimumResultsForSearch: -1
    });
    $(".select-search").select2({
        theme: "classic"
    });
    $("#refresh_box").on('click', ".sorting,.sorting_asc,.sorting_desc", function () {
        var params = $("#form").serializeArray();
        var sort_name = {name: 'sort_field', value: $(this).attr('data-sort-field')};
        var sort_type = {name: 'sort_type', value: $(this).attr('class')};
        params.push(sort_name);
        params.push(sort_type);
        loadList(params);
    });
    $("#form").Validform({
        ajaxPost: true,
        tiptype: function (msg, o, cssctl) {
            if (!o.obj.is("form")) {
                var $parent = o.obj.parents(".div-container");
                var $objtip = $parent.find(".Validform_checktip");
                cssctl($objtip, o.type);
                if (o.type === 2) {
                    $objtip.text("");
                } else if (o.type == 3) {
                    $objtip.addClass('error');
                    $objtip.text(msg);
                }
            }
        },
        callback: function (data) {
            if (data.status == 1) {
                $("#refresh_box").html(data.content);
            } else {
                toastr.error(data.info);
            }
        },
        showAllError: true
    });
</script>
<include file='Public/_end'/>